package com.ruoyi.common.domain.word;

import com.ruoyi.common.domain.word.vo.CommonWordBaseVo;
import com.ruoyi.common.domain.word.vo.CommonWordPronounceBaseVo;
import com.ruoyi.common.domain.word.vo.CommonWordVo;
import org.apache.commons.collections4.CollectionUtils;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class CommonWord {

    @Id
    @Column(name="ID",length=11, unique=true)
    @GeneratedValue(generator="JDBC")
    private Long id;

    private String name;

    private String simplePh;

    private String completePh;

    private String engPh;
    private String raPh;
    private String imagMem;

    private Date addTime;

    private Date updateTime;

    private Long updateUid;

    private String note;

    private String disassembly;

    @Transient
    private String vocabularyName;


    /**
     *  @author: bukaa
     *  @Date: 2020-05-19 10:37
     *  @Description: 例句数量
     */
    private Integer exSenNum;


    /**
     *  @author: bukaa
     *  @Date: 2020-05-19 10:37
     *  @Description: 例句数据【有释义】
     */
    private Integer exSenPhNum;


    /**
     *  @author: bukaa
     *  @Date: 2020-05-19 20:27
     *  @Description: 单词全部例句(非实时数据)
     */
    private Integer exSenPreNum;

    /**
     * 真题词频
     */
    private Integer realSubWordFreq;

    /**
     * 是否是我的生词本内的单词
     */
    @Transient
    private Boolean isMyVocabulary;

    @Transient
    private String prefix;
    @Transient
    private String stem;
    @Transient
    private String suffix;

    @Transient
    private Long vocId;

    @Transient
    private List<CommonWordRa> raList;

    @Transient
    private List<CommonWordPhrase> phraseList;

    @Transient
    private List<CommonWordPronounce> pronounceList;
    @Transient
    private List<CommonWordForm> formList;

    @Transient
    private List<CommonWordSimpleSentence> simpleSentenceList;

    @Transient
    private List<CommonWordSentence> sentenceList;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSimplePh() {
        return simplePh;
    }

    public void setSimplePh(String simplePh) {
        this.simplePh = simplePh;
    }

    public String getCompletePh() {
        return completePh;
    }

    public void setCompletePh(String completePh) {
        this.completePh = completePh;
    }

    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Long getUpdateUid() {
        return updateUid;
    }

    public void setUpdateUid(Long updateUid) {
        this.updateUid = updateUid;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public String getDisassembly() {
        return disassembly;
    }

    public void setDisassembly(String disassembly) {
        this.disassembly = disassembly;
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    public String getStem() {
        return stem;
    }

    public void setStem(String stem) {
        this.stem = stem;
    }

    public String getSuffix() {
        return suffix;
    }

    public void setSuffix(String suffix) {
        this.suffix = suffix;
    }

    public List<CommonWordRa> getRaList() {
        return raList;
    }

    public void setRaList(List<CommonWordRa> raList) {
        this.raList = raList;
    }

    public Integer getExSenNum() {
        return exSenNum;
    }

    public void setExSenNum(Integer exSenNum) {
        this.exSenNum = exSenNum;
    }

    public Integer getExSenPhNum() {
        return exSenPhNum;
    }

    public void setExSenPhNum(Integer exSenPhNum) {
        this.exSenPhNum = exSenPhNum;
    }

    public Integer getExSenPreNum() {
        return exSenPreNum;
    }

    public void setExSenPreNum(Integer exSenPreNum) {
        this.exSenPreNum = exSenPreNum;
    }

    public List<CommonWordPhrase> getPhraseList() {
        return phraseList;
    }

    public void setPhraseList(List<CommonWordPhrase> phraseList) {
        this.phraseList = phraseList;
    }

    public List<CommonWordPronounce> getPronounceList() {
        return pronounceList;
    }

    public void setPronounceList(List<CommonWordPronounce> pronounceList) {
        this.pronounceList = pronounceList;
    }

    public List<CommonWordForm> getFormList() {
        return formList;
    }

    public void setFormList(List<CommonWordForm> formList) {
        this.formList = formList;
    }

    public Integer getRealSubWordFreq() {
        return realSubWordFreq;
    }

    public void setRealSubWordFreq(Integer realSubWordFreq) {
        this.realSubWordFreq = realSubWordFreq;
    }

    public Boolean getMyVocabulary() {
        return isMyVocabulary;
    }

    public void setMyVocabulary(Boolean myVocabulary) {
        isMyVocabulary = myVocabulary;
    }

    public Long getVocId() {
        return vocId;
    }

    public void setVocId(Long vocId) {
        this.vocId = vocId;
    }

    public String getVocabularyName() {
        return vocabularyName;
    }

    public void setVocabularyName(String vocabularyName) {
        this.vocabularyName = vocabularyName;
    }

    public String getEngPh() {
        return engPh;
    }

    public void setEngPh(String engPh) {
        this.engPh = engPh;
    }

    public String getRaPh() {
        return raPh;
    }

    public void setRaPh(String raPh) {
        this.raPh = raPh;
    }

    public List<CommonWordSimpleSentence> getSimpleSentenceList() {
        return simpleSentenceList;
    }

    public void setSimpleSentenceList(List<CommonWordSimpleSentence> simpleSentenceList) {
        this.simpleSentenceList = simpleSentenceList;
    }

    public List<CommonWordSentence> getSentenceList() {
        return sentenceList;
    }

    public void setSentenceList(List<CommonWordSentence> sentenceList) {
        this.sentenceList = sentenceList;
    }

    public String getImagMem() {
        return imagMem;
    }

    public void setImagMem(String imagMem) {
        this.imagMem = imagMem;
    }

    public CommonWord() {
    }

    public CommonWord(String name) {
        this.name = name;
    }

    public CommonWord(Long id) {
        this.id = id;
    }

    public CommonWord(Long id, String name) {
        this.id = id;
        this.name = name;
    }

    public CommonWordVo toVo(){
        CommonWordVo vo = new CommonWordVo();
        vo.setId(this.getId());
        vo.setName(this.getName());
        vo.setK(this.getName());
        vo.setSimplePh(this.getSimplePh());
        vo.setCompletePh(this.getCompletePh());
        return vo;
    }

    public CommonWordBaseVo toBaseVo() {
        CommonWordBaseVo vo = new CommonWordBaseVo();
        vo.setId(this.getId());
        vo.setName(this.getName());
        vo.setVocabularyName(this.getVocabularyName());
        vo.setVocId(this.getVocId());
        if(CollectionUtils.isNotEmpty(this.getPronounceList())) {
            List<CommonWordPronounceBaseVo> list = new ArrayList<>(this.getPronounceList().size());
            this.getPronounceList().forEach(p -> {
                list.add(p.toVo());
            });
            vo.setPronounceList(list);
        }
        return vo;
    }
}